package com.example.gpstracking.database;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class SharedPreferenceSaver {
	
	private Context mContext;
	private SharedPreferences mSharedPreferences;
	public static String NAME_SHAREPREFS = "MINHPREFS";
	public static String KEY_SHAREPREFS = "LOCATIONS";
	
	public SharedPreferenceSaver ( Context context )
	{
		mContext = context;
		mSharedPreferences = mContext.getSharedPreferences(NAME_SHAREPREFS, Context.MODE_PRIVATE);
	}
	/**
	 * save lat , long 
	 */
	public void savePreferences(double lat, double lng)
	{
		Editor editor = mSharedPreferences.edit();
		editor.putString(KEY_SHAREPREFS, lat+","+lng);
		editor.commit();
	}
	/**
	 * get lat, long
	 * lat first, long second
	 */
	public String getPreferences()
	{		
		//Editor editor = mSharedPreferences.edit();
		return mSharedPreferences.getString(KEY_SHAREPREFS, null);
	}

}
